package com.heima.article.feign;

import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import freemarker.template.TemplateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @author 黄晏凯
 */
@RestController
@RequestMapping("/api/v1/article")
public class ArticleClient {

    @Autowired
    private ApArticleService apArticleService;

    @PostMapping("/save")
    public ResponseResult saveArticle(@RequestBody ArticleDto dto) throws TemplateException, IOException {
        /*try {
            Thread.sleep(60 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
        return apArticleService.saveArticle(dto);
    }

}